/*
 * RetrievalProcessor.h
 *
 *  Created on: Oct 22, 2011
 *      Author: gassa
 */
#ifndef RETRIEVALPROCESSOR_H_
#define RETRIEVALPROCESSOR_H_

#include <queue>
#include <algorithm>
#include <set>

#include <math.h>

#include "../include/CUtilities.h"
#include "../QueryProcessor/IQueryProcessor.h"
#include "QueryRepresentation.h"
#include "../ScoreCoculator/SortByDF.h"



//typedef priority_queue<Term*, vector<Term*>, SortByDF> DOCUMENTQUEUE;

class RetrievalProcessor {
	IQueryProcessor* basicQP;
	int queryMode;
	string batchFilePath;
	vector<QueryRepresentation> qrList;
	map<char, IQueryProcessor*> query_mode_parser;
	IndexLoader* indexLoader;
    map<double,string> sortResultByScore(map<int,double> result);



public:
    string staticScoreFile;
	RetrievalProcessor();
	void init();
	~RetrievalProcessor();
    string getBatchFilePath() const;
    int getQueryMode() const;
    void setBatchFilePath(string batchFilePath);
    //string getStaticScoreFile() const;
    //void setStaticScoreFile(string staticScoreFile);
    void setQueryMode(int queryMode);
    void processRetrieve(int scoreModelKey);
    vector<Term*> retrivalPostiongList(QueryRepresentation qr);
    map<double, string> ComputeBoolenScore(vector<Term*> v);
    map<double, string> ComputeVSM(vector<Term*> v);
    map<double, string> ComputeOkapi(vector<Term*> v);
    void outputFile(map<double, string> &docMap, QueryRepresentation qr, bool isBatch);
    void generateSnippet(string filePath, string query);
    void sortByStaticScore(map<double, string> &docMap,QueryRepresentation qr);
};

#endif /* RETRIEVALPROCESSOR_H_ */
